package multiplus.base.role.action;

import java.sql.SQLException;

import multiplus.base.role.model.User;
import multiplus.base.role.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/user")
public class UserAction {
	@Autowired
	private UserService userService;

	@RequestMapping("/save")
	public void save(@RequestParam("id") Integer id, ModelMap modelMap) throws SQLException {
		User user = new User();
		user.setId(id);
		user.setUsername("lixiaodan");
		userService.save(user);
	}

	@RequestMapping("/delete")
	public void delete(@RequestParam("id") Integer id, ModelMap modelMap) throws SQLException {
		userService.delete(id);
	}
}
